package com.tuanzi.loan.web.bean.compensation;

import com.google.common.collect.Lists;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.request.compensation.CompensationChildOrderRequest;
import com.tuanzi.loan.vo.response.compensation.CompensationChildOrderResponse;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.compensation.CompensationChildOrderLazyDataModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import java.util.List;

import static com.tuanzi.loan.business.constants.DictionaryCode.COMPENSATION_ORDER_STATUS;

/**
 * @author caiwanlin
 * @create 2019-02-13 11:50
 */
@Data
@Debug
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class CompensationChildOrderListBean extends
        JSFListingBean<CompensationChildOrderRequest,CompensationChildOrderResponse> {
    @PostConstruct
    public void init() throws Exception {
        initLazyDataModel();
    }

    private void initLazyDataModel() throws Exception {
        $ = new CompensationChildOrderRequest();
        lazyDataModel = new CompensationChildOrderLazyDataModel($);
    }

    public void onReset() throws Exception{
        initLazyDataModel();
    }

    @Override
    protected List<String> getDictionaryCodes() {
        return Lists.newArrayList(COMPENSATION_ORDER_STATUS);
    }
}
